-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util/log: replace gen.sh by a go template generator #57589
Conversation
ba84dc0
to
c7451e4
Compare
Makefile
Outdated
docs/generated/logging.md: pkg/util/log/gen.sh pkg/util/log/logpb/log.proto | ||
bash $< logging.md >[email protected] || { rm -f [email protected]; exit 1; } | ||
docs/generated/logging.md: pkg/util/log/gen.go pkg/util/log/logpb/log.proto | ||
$(GO) run $^ logging.md [email protected] || { rm -f [email protected]; exit 1; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may need $(GOMODVENDOR) flags
// If we are generating a .go file, do a pass of gofmt. | ||
newBytes := src.Bytes() | ||
if strings.HasSuffix(tmplName, ".go") { | ||
newBytes, err = format.Source(newBytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not crlfmt ;) ?
Comment string | ||
PComment string | ||
Name string | ||
NAME string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not NameUpper
?
I think you call also use call strings.Lower "bob"
in a template, but this looks used often enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @itsbilal and @otan)
Makefile, line 1548 at r1 (raw file):
Previously, otan (Oliver Tan) wrote…
may need $(GOMODVENDOR) flags
Done.
pkg/util/log/gen.go, line 69 at r1 (raw file):
Previously, otan (Oliver Tan) wrote…
why not crlfmt ;) ?
This code does not need it.
(Also crlfmt is not built to be embedded alas)
pkg/util/log/gen.go, line 97 at r1 (raw file):
Previously, otan (Oliver Tan) wrote…
why not
NameUpper
?I think you call also use
call strings.Lower "bob"
in a template, but this looks used often enough
Yes for the same reason .NAME is shorter than .NameUpper. I cannot use .name
because templates only work with exported names (:sob:)
This prevents build problems due to folk not using a `bash` that's modern enough. Release note: None
bors r=otan |
Build succeeded: |
This prevents build problems due to folk not using a
bash
that'smodern enough.
Release note: None